<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!--  @Autor: Flávio CANTUÁRIA -->

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.prime.com.tr/ui"
	template="../../layout/template.xhtml">

	<ui:define name="body">
		<h:form id="consultaForm">
			<p:panel id="panelConsutlta" header="Consulta de Pessoas">
		
				<p:messages id = "msg"/>
			
				<p:dataTable var="pes" value="#{pessoa.pessoas}" paginator="true" rows="10"
                			id="tabela"	onRowSelectUpdate="display" >  

			        <p:column id="nome" filterBy="#{pes.nome}" filterMatchMode="contains">  
			            <f:facet name="header">  
			                    Nome  
			            </f:facet>  
			            <h:outputText value="#{pes.nome}" />  
			        </p:column>
			        
			        <p:column id = "cpf" filterBy="#{pes.cpf}">  
			            <f:facet name="header">  
			                    CPF  
			            </f:facet>  
			            <h:outputText value="#{pes.cpf}" />  
			        </p:column>
			        
			        <p:column id = "endereco" filterBy="#{pes.endereco}" filterMatchMode="contains">  
			            <f:facet name="header">  
			                    Endereço  
			            </f:facet>  
			            <h:outputText value="#{pes.endereco}" />  
			        </p:column>
			        
			        <p:column>  
			            <f:facet name="header">  
			                    Opções  
			            </f:facet>  
				           
						<div id="options">
							<h:commandLink value="Editar" action="#{pessoa.edit}">  
	      						<f:param name="PessoaId" value="#{pes.id}" />  
						    </h:commandLink>  
						    
						    <p:spacer width="15" height="1"/>
						    
						    <h:commandLink value="Excluir" action="#{pessoa.deletar}">  
	      						<f:param name="PessoaId" value="#{pes.id}" />  
						    </h:commandLink>
						</div> 
  
			        </p:column>
			    </p:dataTable>
			</p:panel>
		</h:form> 
	
	</ui:define>
</ui:composition>
